﻿using B.S.BasicData.Api.Write.Application.Command.MyLog;
using B.S.BasicData.Api.Write.Filters;
using B.S.BasicData.ErrorCode;
using B.S.BasicData.Infrastructure.Interface;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.BasicData.Api.Write.Controllers
{
    /// <summary>
    /// 日志控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LogController : ControllerBase
    {
        private readonly IMediator mediator;

        public LogController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 添加日志接口
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        [AccessTokenFilter]
        public  Task<ApiResult<int>> CreateLog(CreateLogCommand request) { 
        return mediator.Send(request);
        }
    }
}
